<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户管理</title>
    <script src="https://cdn.staticfile.org/vue/3.2.31/vue.global.min.js"></script>
    <script src="https://cdn.staticfile.org/axios/1.5.0/axios.min.js"></script>
</head>

<body>
    <div id="app">
        <!-- {{ data.total }} -->
        <table>
            <thead>
                <tr>
                    <th>用户名</th>
                    <th>昵称</th>
                    <th>手机号码</th>
                    <th>状态</th>
                    <th>创建时间</th>
                    <th>创建人</th>
                </tr>
            </thead>
            <tbody>
                <tr v-for="site in data.data">
                    <td>{{ site.username }}</td>
                    <td>{{ site.nickname}}</td>
                    <td>{{ site.phone}}</td>
                    <td>{{ site.status}}</td>
                    <td>{{ site.createDatetime }}</td>
                    <td>{{ site.createBy }}</td>
                </tr>
            </tbody>
        </table>
    </div>
    <script>
        const app = {
            data() {
                return {
                    data: 'Ajax get 方法远程获取用户信息！'
                }
            },
            mounted() {
                axios
                    .get('http://localhost:8081/user/page')
                    .then(response => (this.data = response.data))
                    .catch(function (error) {   // 请求失败处理
                        console.log(error);
                });
            }
        }
        Vue.createApp(app).mount('#app')
    </script>
     <style>
        table {
            width: 40%;
            border-collapse: collapse;
            border-spacing: 0;
            empty-cells: show;
            border: 1px solid #e9e9e9;
        }

        table th {
            background: #f7f7f7;
            color: #5c6b77;
            font-weight: 600;
            white-space: nowrap;
        }

        table td,
        table th {
            padding: 8px 16px;
            border: 1px solid #e9e9e9;
            text-align: left;
        }
    </style>
</body>

</html>